package com.taobao.api.request;

import java.util.Date;
import java.util.Map;

import com.taobao.api.ApiRuleException;
import com.taobao.api.TaobaoRequest;
import com.taobao.api.internal.util.RequestCheckUtils;
import com.taobao.api.internal.util.TaobaoHashMap;
import com.taobao.api.response.TopatsTasksGetResponse;

/**
 * TOP API: taobao.topats.tasks.get request
 * 
 * @author auto create
 * @since 1.0, 2013-07-21 16:38:14
 */
public class TopatsTasksGetRequest implements TaobaoRequest<TopatsTasksGetResponse> {

  private Map<String, String> headerMap = new TaobaoHashMap();
  private TaobaoHashMap       udfParams;                      // add
                                                              // user-defined
                                                              // text parameters
  private Long                timestamp;

  /**
   * 要查询的已经创建的定时任务的结束时间(这里的时间是指执行时间)。
   */
  private Date                endTime;

  /**
   * 要查询的已创建过的定时任务的开始时间(这里的时间是指执行时间)。
   */
  private Date                startTime;

  public void setEndTime(Date endTime) {
    this.endTime = endTime;
  }

  public Date getEndTime() {
    return this.endTime;
  }

  public void setStartTime(Date startTime) {
    this.startTime = startTime;
  }

  public Date getStartTime() {
    return this.startTime;
  }

  public Long getTimestamp() {
    return this.timestamp;
  }

  public void setTimestamp(Long timestamp) {
    this.timestamp = timestamp;
  }

  public String getApiMethodName() {
    return "taobao.topats.tasks.get";
  }

  public Map<String, String> getTextParams() {
    TaobaoHashMap txtParams = new TaobaoHashMap();
    txtParams.put("end_time", this.endTime);
    txtParams.put("start_time", this.startTime);
    if (this.udfParams != null) {
      txtParams.putAll(this.udfParams);
    }
    return txtParams;
  }

  public void putOtherTextParam(String key, String value) {
    if (this.udfParams == null) {
      this.udfParams = new TaobaoHashMap();
    }
    this.udfParams.put(key, value);
  }

  public Class<TopatsTasksGetResponse> getResponseClass() {
    return TopatsTasksGetResponse.class;
  }

  public void check() throws ApiRuleException {
    RequestCheckUtils.checkNotEmpty(endTime, "endTime");
    RequestCheckUtils.checkNotEmpty(startTime, "startTime");
  }

  public Map<String, String> getHeaderMap() {
    return headerMap;
  }
}
